package com.oamicnet.mapstruct.mapper;

import com.oamicnet.mapstruct.controller.dto.StudentDTO;
import com.oamicnet.mapstruct.entity.Student;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper
public interface StudentMapper {

    StudentMapper INSTANCE = Mappers.getMapper(StudentMapper.class);

    @InheritInverseConfiguration
    StudentDTO studentToStudentDTO(Student student);

    @Mapping(source = "dateOfBirth", target = "dateOfBirth", dateFormat = "yyyy-MM-dd")
    @Mapping(source = "name", target = "studName")
    @Mapping(source = "id", target = "studId")
    Student studentDTOToStudent(StudentDTO studentDTO);

}
